﻿using System;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using S3.Common;

namespace S3
{
    public partial class About : S3FormBase
    {
        const string Version = "S3 - Phiên bản {0}";

        public About()
        {
            InitializeComponent();
            lblVersionInfo.Text = string.Format(Version, Application.ProductVersion);
            var ass = Assembly.GetExecutingAssembly();
            var file = new FileInfo(ass.Location);
            lblPublishedDate.Text = file.LastWriteTime.ToShortDateString();
        }

        #region ProcessCmdKey
        /// <summary>
        /// Close form if click ESC
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="keyData"></param>
        /// <returns></returns>
        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
        {
            try
            {
                if (msg.WParam.ToInt32() == (int)Keys.Escape)
                {
                    this.Close();
                }
                else
                {
                    return base.ProcessCmdKey(ref msg, keyData);
                }
            }
            catch (Exception Ex)
            {
                XtraMessageBox.Show("Key Overrided Events Error:" + Ex.Message);
            }

            return base.ProcessCmdKey(ref msg, keyData);
        }
        #endregion


        private void LinkLabel2LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://cloud2s.com");
        }

    }
}
